﻿<!--
 * Copyright (c) 2010, Andriy Syrov
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided 
 * that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of conditions and the 
 * following disclaimer.
 * 
 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and 
 * the following disclaimer in the documentation and/or other materials provided with the distribution.
 *
 * Neither the name of Andriy Syrov nor the names of his contributors may be used to endorse or promote 
 * products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY 
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 *   
 -->

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:TimelineLibrary;assembly=TimelineLibrary"
    xmlns:me="clr-namespace:TimelineEx"
    xmlns:lib="clr-namespace:TimelineExLib"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ex="clr-namespace:TimelineEx"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary
            Source="/TimelineExLib;Component/Themes/Constants.xaml" />
        <ResourceDictionary
            Source="/TimelineExLib;Component/Themes/NavigationStyle.xaml" />
        <ResourceDictionary
            Source="/TimelineExLib;Component/Themes/ToolboxButtonStyle.xaml" />        
    </ResourceDictionary.MergedDictionaries>

    <me:BoolToVisibilityConverter
        x:Key="BoolToVisibilityConverter" />

    <local:NullToUnsetConverter
        x:Key="NullToUnsetConverter"></local:NullToUnsetConverter>

    <ControlTemplate
        x:Key="EventTooltipStyle"
        TargetType="ToolTip">
        <Border
            BorderBrush="Silver"
            BorderThickness="1"
            Background="{StaticResource EventTooltipBackground}">
            <StackPanel
                Margin="5"
                MaxWidth="400">

                <TextBlock
                    Margin="0,0,0,0"
                    Text="{Binding Event.Title, Mode=OneWay}"
                    MinWidth="{Binding EventPixelWidth}"
                    TextWrapping="NoWrap"
                    Foreground="{StaticResource EventTooltipTitleForeground}"
                    HorizontalAlignment="Left">
                </TextBlock>

                <TextBlock
                    Margin="0,0,0,0"
                    Text="{Binding Event.Description, Mode=OneWay}"
                    TextWrapping="Wrap"
                    Foreground="{StaticResource EventTooltipDescriptionForeground}"
                    FontStyle="italic"
                    HorizontalAlignment="Left"
                    FontSize="11">
                </TextBlock>
            </StackPanel>
        </Border>
    </ControlTemplate>

    <Style
        x:Key="TimelineScrollBarStyle"
        TargetType="ScrollBar">
        <Setter
            Property="MinWidth"
            Value="17" />
        <Setter
            Property="MinHeight"
            Value="17" />
        <Setter
            Property="IsTabStop"
            Value="False" />
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="ScrollBar">
                    <Grid
                        x:Name="Root">
                        <Grid.Resources>
                            <ControlTemplate
                                x:Key="RepeatButtonTemplate"
                                TargetType="RepeatButton">
                                <Grid
                                    x:Name="Root"
                                    Background="Transparent">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup
                                            x:Name="CommonStates">
                                            <VisualState
                                                x:Name="Normal" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate
                                x:Key="HorizontalIncrementTemplate"
                                TargetType="RepeatButton">
                                <Grid
                                    x:Name="Root">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup
                                            x:Name="CommonStates">
                                            <VisualState
                                                x:Name="Normal" />
                                            <VisualState
                                                x:Name="MouseOver" />
                                            <VisualState
                                                x:Name="Pressed" />
                                            <VisualState
                                                x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation
                                                        Duration="0:0:0"
                                                        To=".7"
                                                        Storyboard.TargetProperty="Opacity"
                                                        Storyboard.TargetName="DisabledElement" />
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Rectangle
                                        x:Name="Background"
                                        Fill="DarkGray"
                                        Opacity="0"
                                        RadiusY="2"
                                        RadiusX="2"
                                        StrokeThickness="1">
                                    </Rectangle>
                                    <Rectangle
                                        x:Name="BackgroundAnimation"
                                        Fill="#FF448DCA"
                                        Opacity="0"
                                        RadiusY="1"
                                        RadiusX="1"
                                        Stroke="#00000000"
                                        StrokeThickness="1" />
                                    <Rectangle
                                        x:Name="BackgroundGradient"
                                        Margin="1"
                                        Opacity="0"
                                        RadiusY="1"
                                        RadiusX="1"
                                        Fill="DarkGray"
                                        Stroke="#FFFFFFFF"
                                        StrokeThickness="1">
                                    </Rectangle>
                                    <Rectangle
                                        x:Name="Highlight"
                                        IsHitTestVisible="false"
                                        Margin="1"
                                        Opacity="0"
                                        RadiusY="1"
                                        RadiusX="1"
                                        Stroke="#FF6DBDD1"
                                        StrokeThickness="1" />
                                    <Path
                                        Data="F1 M 511.047,352.682L 511.047,342.252L 517.145,347.467L 511.047,352.682 Z "
                                        Height="8"
                                        Stretch="Uniform"
                                        Width="4">
                                        <Path.Fill>
                                            <SolidColorBrush
                                                x:Name="ButtonColor"
                                                Color="Silver" />
                                        </Path.Fill>
                                    </Path>
                                    <Rectangle
                                        x:Name="DisabledElement"
                                        Fill="#FFFFFFFF"
                                        Opacity="0"
                                        RadiusY="2"
                                        RadiusX="2" />
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate
                                x:Key="VerticalIncrementTemplate"
                                TargetType="RepeatButton">
                                <Grid
                                    x:Name="Root">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup
                                            x:Name="CommonStates">
                                            <VisualState
                                                x:Name="Normal" />
                                            <VisualState
                                                x:Name="MouseOver" />
                                            <VisualState
                                                x:Name="Pressed" />
                                            <VisualState
                                                x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation
                                                        Duration="0:0:0"
                                                        To=".7"
                                                        Storyboard.TargetProperty="Opacity"
                                                        Storyboard.TargetName="DisabledElement" />
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Rectangle
                                        x:Name="Background"
                                        Fill="DarkGray"
                                        Opacity="0"
                                        RadiusY="2"
                                        RadiusX="2"
                                        StrokeThickness="1">
                                        <Rectangle.Stroke>
                                            <LinearGradientBrush
                                                EndPoint="1,.5"
                                                StartPoint="0,.5">
                                                <GradientStop
                                                    Color="#FF647480"
                                                    Offset="1" />
                                                <GradientStop
                                                    Color="#FFAEB7BF"
                                                    Offset="0" />
                                                <GradientStop
                                                    Color="#FF919EA7"
                                                    Offset="0.35" />
                                                <GradientStop
                                                    Color="#FF7A8A99"
                                                    Offset="0.35" />
                                            </LinearGradientBrush>
                                        </Rectangle.Stroke>
                                    </Rectangle>
                                    <Rectangle
                                        x:Name="BackgroundMouseOver"
                                        Fill="#FF448DCA"
                                        Opacity="0"
                                        RadiusY="1"
                                        RadiusX="1"
                                        Stroke="#00000000"
                                        StrokeThickness="1" />
                                    <Rectangle
                                        x:Name="BackgroundPressed"
                                        Fill="DarkGray"
                                        Opacity="0"
                                        RadiusY="2"
                                        RadiusX="2"
                                        Stroke="#00000000"
                                        StrokeThickness="1" />
                                    <Rectangle
                                        x:Name="BackgroundGradient"
                                        Margin="1"
                                        Opacity="0"
                                        RadiusY="1"
                                        RadiusX="1"
                                        Stroke="#FFFFFFFF"
                                        StrokeThickness="1">
                                        <Rectangle.Fill>
                                            <LinearGradientBrush
                                                EndPoint="1,.7"
                                                StartPoint="0,.7">
                                                <GradientStop
                                                    Color="#FFFFFFFF"
                                                    Offset="0.013" />
                                                <GradientStop
                                                    Color="#F9FFFFFF"
                                                    Offset="0.375" />
                                                <GradientStop
                                                    Color="#E5FFFFFF"
                                                    Offset="0.603" />
                                                <GradientStop
                                                    Color="#C6FFFFFF"
                                                    Offset="1" />
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                    <Rectangle
                                        x:Name="Highlight"
                                        IsHitTestVisible="false"
                                        Margin="1"
                                        Opacity="0"
                                        RadiusY="1"
                                        RadiusX="1"
                                        Stroke="#FF6DBDD1"
                                        StrokeThickness="1" />
                                    <Path
                                        Data="F1 M 531.107,321.943L 541.537,321.943L 536.322,328.042L 531.107,321.943 Z "
                                        Height="4"
                                        Stretch="Uniform"
                                        Width="8">
                                        <Path.Fill>
                                            <SolidColorBrush
                                                x:Name="ButtonColor"
                                                Color="Silver" />
                                        </Path.Fill>
                                    </Path>
                                    <Rectangle
                                        x:Name="DisabledElement"
                                        Fill="#FFFFFFFF"
                                        Opacity="0"
                                        RadiusY="2"
                                        RadiusX="2" />
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate
                                x:Key="VerticalDecrementTemplate"
                                TargetType="RepeatButton">
                                <Grid
                                    x:Name="Root">
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup
                                            x:Name="CommonStates">
                                            <VisualState
                                                x:Name="Normal" />
                                            <VisualState
                                                x:Name="MouseOver" />
                                            <VisualState
                                                x:Name="Pressed" />
                                            <VisualState
                                                x:Name="Disabled">
                                                <Storyboard>
                                                    <DoubleAnimation
                                                        Duration="0:0:0"
                                                        To=".7"
                                                        Storyboard.TargetProperty="Opacity"
                                                        Storyboard.TargetName="DisabledElement" />
                                                </Storyboard>
                                            </VisualState>
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Rectangle
                                        x:Name="Background"
                                        Fill="DarkGray"
                                        Opacity="0"
                                        RadiusY="2"
                                        RadiusX="2"
                                        StrokeThickness="1">
                                    </Rectangle>
                                    <Rectangle
                                        x:Name="BackgroundPressed"
                                        Fill="DarkGray"
                                        Opacity="0"
                                        RadiusY="2"
                                        RadiusX="2"
                                        Stroke="#00000000"
                                        StrokeThickness="1" />
                                    <Rectangle
                                        x:Name="Highlight"
                                        IsHitTestVisible="false"
                                        Margin="1"
                                        Opacity="0"
                                        RadiusY="1"
                                        RadiusX="1"
                                        Stroke="#FF6DBDD1"
                                        StrokeThickness="1" />
                                    <Path
                                        Data="F1 M 541.537,173.589L 531.107,173.589L 536.322,167.49L 541.537,173.589 Z "
                                        Height="4"
                                        Stretch="Uniform"
                                        Width="8">
                                        <Path.Fill>
                                            <SolidColorBrush
                                                x:Name="ButtonColor"
                                                Color="Silver" />
                                        </Path.Fill>
                                    </Path>
                                    <Rectangle
                                        x:Name="DisabledElement"
                                        Fill="#FFFFFFFF"
                                        Opacity="0"
                                        RadiusY="2"
                                        RadiusX="2" />
                                </Grid>
                            </ControlTemplate>
                            <ControlTemplate
                                x:Key="VerticalThumbTemplate"
                                TargetType="Thumb">
                                <Grid>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup
                                            x:Name="CommonStates">
                                            <VisualState
                                                x:Name="Normal" />
                                            <VisualState
                                                x:Name="MouseOver">
                                                <Storyboard>
                                                    <ColorAnimation
                                                        Duration="0"
                                                        To="#FFBDBDBD"
                                                        Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
                                                        Storyboard.TargetName="Background"
                                                        d:IsOptimized="True" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState
                                                x:Name="Pressed" />
                                            <VisualState
                                                x:Name="Disabled" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Grid
                                        x:Name="ThumbVisual"
                                        Margin="2,0,2,0">
                                        <Rectangle
                                            x:Name="Background"
                                            Fill="Gray"
                                            StrokeThickness="0"
                                            RadiusX="4"
                                            Margin="2"
                                            RadiusY="4">
                                        </Rectangle>
                                        <Rectangle
                                            x:Name="BackgroundPressed"
                                            Fill="#FFCDCDCD"
                                            Opacity="0"
                                            Stroke="#00000000"
                                            StrokeThickness="0"
                                            RadiusX="4"
                                            Margin="2"
                                            RadiusY="4" />
                                    </Grid>
                                </Grid>
                            </ControlTemplate>
                        </Grid.Resources>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup
                                x:Name="CommonStates">
                                <VisualState
                                    x:Name="Normal" />
                                <VisualState
                                    x:Name="MouseOver" />
                                <VisualState
                                    x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation
                                            Duration="0"
                                            To="0.5"
                                            Storyboard.TargetProperty="Opacity"
                                            Storyboard.TargetName="Root" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid
                            x:Name="VerticalRoot"
                            Visibility="Collapsed">
                            <Grid.RowDefinitions>
                                <RowDefinition
                                    Height="Auto" />
                                <RowDefinition
                                    Height="Auto" />
                                <RowDefinition
                                    Height="Auto" />
                                <RowDefinition
                                    Height="*" />
                                <RowDefinition
                                    Height="Auto" />
                            </Grid.RowDefinitions>
                            <Rectangle
                                RadiusY="1"
                                RadiusX="1"
                                Grid.RowSpan="5"
                                Stroke="#FF444444"
                                Fill="#FF3D3D3D"
                                StrokeThickness="1">
                            </Rectangle>
                            <RepeatButton
                                x:Name="VerticalSmallDecrease"
                                Height="16"
                                IsTabStop="False"
                                Interval="50"
                                Margin="1"
                                Grid.Row="0"
                                Template="{StaticResource VerticalDecrementTemplate}" />
                            <RepeatButton
                                x:Name="VerticalLargeDecrease"
                                Height="0"
                                IsTabStop="False"
                                Interval="50"
                                Grid.Row="1"
                                Template="{StaticResource RepeatButtonTemplate}" />
                            <Thumb
                                x:Name="VerticalThumb"
                                Height="18"
                                MinHeight="18"
                                Grid.Row="2"
                                Template="{StaticResource VerticalThumbTemplate}" />
                            <RepeatButton
                                x:Name="VerticalLargeIncrease"
                                IsTabStop="False"
                                Interval="50"
                                Grid.Row="3"
                                Template="{StaticResource RepeatButtonTemplate}" />
                            <RepeatButton
                                x:Name="VerticalSmallIncrease"
                                Height="16"
                                IsTabStop="False"
                                Interval="50"
                                Margin="1"
                                Grid.Row="4"
                                Template="{StaticResource VerticalIncrementTemplate}" />
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style
        TargetType="lib:TimelineBandEx">
        <Setter 
            Property="ScrollBarStyle" 
            Value="{StaticResource TimelineScrollBarStyle}" />
        
        <Setter
            Property="DefaultShortEventTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid>
                        <Rectangle
                            Margin="0"
                            RadiusX="1"
                            RadiusY="1"
                            MinWidth="4"
                            Width="{Binding EventPixelWidth}"
                            Fill="{Binding EventColorBrush, Mode=OneWay}"
                            StrokeThickness="0"
                            VerticalAlignment="Top"
                            Height="3">

                            <local:TooltipServiceEx.ToolTipEx>
                                <local:ToolTipEx
                                    HideToolTipTimeout="60" />
                            </local:TooltipServiceEx.ToolTipEx>
                            <ToolTipService.ToolTip>
                                <ToolTip
                                    Template="{StaticResource EventTooltipStyle}" />
                            </ToolTipService.ToolTip>

                        </Rectangle>
                    </Grid>
                </DataTemplate>
            </Setter.Value>
        </Setter>

        <Setter
            Property="DefaultEventTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid
                        Background="{StaticResource EventToolsBackground}"
                        Canvas.Top="{Binding Top, Mode=TwoWay}"
                        x:Name="EventTemplateRoot"
                        Height="{Binding DescriptionHeight, Mode=TwoWay}"
                        Width="{Binding DescriptionWidth, Mode=TwoWay}">

                        <Grid.RowDefinitions>
                            <RowDefinition
                                Height="9"></RowDefinition>
                            <RowDefinition
                                Height="*"></RowDefinition>
                            <RowDefinition
                                Height="8"></RowDefinition>
                        </Grid.RowDefinitions>

                        <Canvas
                            Grid.Row="0"
                            Height="9"
                            Background="{StaticResource EventToolsBackground}"
                            Margin="-6 0 0 0"
                            VerticalAlignment="Stretch"
                            HorizontalAlignment="Stretch">

                            <StackPanel
                                Canvas.Top="1"
                                Canvas.Left="0"
                                Height="8"
                                Background="{StaticResource EventToolsBackground}"
                                Orientation="Horizontal">

                                <Rectangle
                                    x:Name="EventDurationRect"
                                    Canvas.Left="0"
                                    Canvas.Top="0"
                                    Margin="0"
                                    VerticalAlignment="Top"
                                    Height="6"
                                    MinWidth="6"
                                    Width="{Binding EventPixelWidth, Mode=OneWay}"
                                    Fill="{Binding EventColorBrush, Mode=OneWay}"
                                    RadiusX="3"
                                    RadiusY="3">
                                    <local:TooltipServiceEx.ToolTipEx>
                                        <local:ToolTipEx
                                            HideToolTipTimeout="{StaticResource TooltipTimeout}" />
                                    </local:TooltipServiceEx.ToolTipEx>
                                    <ToolTipService.ToolTip>
                                        <ToolTip
                                            Template="{StaticResource EventTooltipStyle}" />
                                    </ToolTipService.ToolTip>
                                </Rectangle>
                                <Border
                                    x:Name="DurationChangeBorder"
                                    Width="8"
                                    Height="8"
                                    VerticalAlignment="Top"
                                    Visibility="{Binding TimelineTray.AllowEditDates, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
                                    Margin="2 0 0 0"
                                    BorderThickness="1"
                                    BorderBrush="{StaticResource EventBorderLineBrush}"
                                    Background="{StaticResource EventBackground}">
                                    <Border
                                        Width="4"
                                        Height="4"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Top"
                                        BorderThickness="0 0 1 1"
                                        BorderBrush="{StaticResource EventBorderLineBrush}"
                                        Background="{StaticResource EventBackground}">
                                    </Border>
                                </Border>
                            </StackPanel>

                            <Border
                                x:Name="BorderLine"
                                Canvas.ZIndex="-1"
                                VerticalAlignment="Stretch"
                                Height="200000"
                                Width="1"
                                Margin="2 1 0 0"
                                Background="{Binding EventColorBrush, Mode=OneWay}" />

                        </Canvas>

                        <Border
                            x:Name="EventDescriptionBorder"
                            Width="{Binding DescriptionWidth, Mode=TwoWay}"
                            Grid.Row="1"
                            BorderThickness="{Binding SelectionBorder, Mode=OneWay}"
                            Visibility="{Binding BorderVisibility, Mode=OneWay}"
                            Padding="2 2 2 2"
                            VerticalAlignment="Stretch"
                            HorizontalAlignment="Stretch"
                            BorderBrush="{StaticResource EventBorderLineBrush}"
                            Background="{StaticResource EventBackground}">

                            <StackPanel>
                                <Grid
                                    x:Name="MediaElementGrid"
                                    Background="DarkGray">

                                    <MediaElement
                                        Source="{Binding Event.Video, Mode=OneWay, Converter={StaticResource NullToUnsetConverter}}"
                                        x:Name="MediaPlayer"
                                        VerticalAlignment="Stretch"
                                        Height="Auto"
                                        Stretch="UniformToFill"
                                        AutoPlay="False">
                                    </MediaElement>
                                </Grid>
                                <Grid
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch">
                                    <HyperlinkButton
                                        HorizontalAlignment="Left"
                                        x:Name="StopPlayButton"
                                        Content="Play/Stop">
                                    </HyperlinkButton>
                                    <HyperlinkButton
                                        Visibility="{Binding TimelineTray.EditMode, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
                                        HorizontalAlignment="Right"
                                        x:Name="EditButton"
                                        Content="Edit">
                                    </HyperlinkButton>
                                </Grid>
                                <StackPanel
                                    Margin="0"
                                    Orientation="Vertical"
                                    VerticalAlignment="Stretch"
                                    HorizontalAlignment="Stretch">

                                    <Image
                                        x:Name="EventImage"
                                        Source="{Binding Event.TeaserEventImage, Converter={StaticResource NullToUnsetConverter}, Mode=OneWay}"
                                        Width="Auto"
                                        Height="Auto"
                                        Stretch="None"
                                        Margin="0 1 0 0"
                                        HorizontalAlignment="Left">
                                        <local:TooltipServiceEx.ToolTipEx>
                                            <local:ToolTipEx
                                                HideToolTipTimeout="{StaticResource TooltipTimeout}" />
                                        </local:TooltipServiceEx.ToolTipEx>
                                        <ToolTipService.ToolTip>
                                            <ToolTip
                                                Template="{StaticResource EventTooltipStyle}" />
                                        </ToolTipService.ToolTip>
                                    </Image>

                                    <TextBlock
                                        Foreground="{StaticResource BandTeaserForeground}"
                                        Margin="0 2 0 0"
                                        Text="{Binding EventTime, Mode=OneWay}">
                                    </TextBlock>

                                    <TextBlock
                                        x:Name="EventTitleTextBlock"
                                        Margin="0,2,0,0"
                                        Text="{Binding Event.Title, Mode=OneWay}"
                                        TextWrapping="Wrap"
                                        Foreground="{StaticResource BandEventTitleForeground}"
                                        MaxHeight="24"
                                        HorizontalAlignment="Left"
                                        Width="Auto">
                                        <local:TooltipServiceEx.ToolTipEx>
                                            <local:ToolTipEx
                                                HideToolTipTimeout="{StaticResource TooltipTimeout}" />
                                        </local:TooltipServiceEx.ToolTipEx>
                                        <ToolTipService.ToolTip>
                                            <ToolTip
                                                Template="{StaticResource EventTooltipStyle}" />
                                        </ToolTipService.ToolTip>
                                    </TextBlock>

                                    <TextBlock
                                        x:Name="EventTeaserBlock"
                                        Margin="0,2,0,0"
                                        Text="{Binding Teaser, Mode=OneWay}"
                                        TextWrapping="Wrap"
                                        Foreground="{StaticResource BandTeaserForeground}"
                                        FontStyle="italic"
                                        MaxHeight="48"
                                        HorizontalAlignment="Left"
                                        FontSize="9.25">
                                    </TextBlock>

                                    <local:Hyperlink
                                        x:Name="EventLinkTextBlock"
                                        Margin="0,2,0,0"
                                        Content="{Binding LinkText, Mode=OneWay}"
                                        HorizontalAlignment="Left"
                                        FontStyle="italic"
                                        FontSize="9.25">
                                    </local:Hyperlink>


                                </StackPanel>
                            </StackPanel>

                        </Border>

                        <Border
                            HorizontalAlignment="Stretch"
                            Height="8"
                            Background="{StaticResource EventToolsBackground}"
                            Grid.Row="2">
                            <Border
                                Visibility="{Binding TimelineTray.EditMode, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
                                x:Name="ResizeButton"
                                Width="8"
                                Height="8"
                                Margin="0 0 0 0"
                                HorizontalAlignment="Right"
                                BorderThickness="1"
                                BorderBrush="{StaticResource EventBorderLineBrush}"
                                Background="{StaticResource EventBackground}">
                                <Border
                                    Width="4"
                                    Height="4"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Top"
                                    BorderThickness="0 0 1 1"
                                    BorderBrush="{StaticResource EventBorderLineBrush}"
                                    Background="{StaticResource EventBackground}">
                                </Border>
                            </Border>
                        </Border>
                    </Grid>
                </DataTemplate>
            </Setter.Value>
        </Setter>

        <Setter
            Property="DefaultItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Grid
                        Background="Transparent"
                        VerticalAlignment="Stretch"
                        HorizontalAlignment="Stretch">

                        <Rectangle
                            Fill="{StaticResource ItemBackground}" />

                        <Rectangle
                            HorizontalAlignment="Left"
                            Margin="0,0,3,0"
                            Width="1"
                            Fill="{StaticResource ItemLineBrush}" />
                    </Grid>
                </DataTemplate>
            </Setter.Value>
        </Setter>

        <Setter
            Property="DefaultTextItemTemplate">
            <Setter.Value>
                <DataTemplate>

                    <Border
                        Canvas.ZIndex="20000"
                        Height="18"
                        Margin="0"
                        BorderThickness="1 1 0 2"
                        BorderBrush="{StaticResource ItemLineBrush}"
                        Background="{StaticResource ItemBackground}">

                        <TextBlock
                            FontFamily="Arial"
                            TextWrapping="Wrap"
                            Margin="0"
                            HorizontalAlignment="Stretch"
                            TextAlignment="Center"
                            VerticalAlignment="Bottom"
                            Foreground="{StaticResource ItemForeground}">
                            
                            <TextBlock.Text>
                                <Binding />
                            </TextBlock.Text>

                        </TextBlock>
                    </Border>

                </DataTemplate>
            </Setter.Value>
        </Setter>

        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="lib:TimelineBandEx">

                    <Grid
                        x:Name="MainGrid"
                        HorizontalAlignment="Stretch"
                        Width="{TemplateBinding Width}"
                        Height="{TemplateBinding Height}"
                        VerticalAlignment="Stretch">

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition
                                Width="10" />
                            <ColumnDefinition
                                Width="*" />
                            <ColumnDefinition
                                Width="10" />
                        </Grid.ColumnDefinitions>

                        <Grid
                            x:Name="NavigateLeft"
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            Grid.Column="0"
                            Background="{StaticResource ItemBackground}">

                            <Grid.RowDefinitions>
                                <RowDefinition
                                    Height="*" />
                                <RowDefinition
                                    Height="20" />
                            </Grid.RowDefinitions>

                            <Button
                                x:Name="NavigateLeftButton"
                                Height="20"
                                HorizontalAlignment="Center"
                                Margin="0"
                                Grid.Row="1"
                                Style="{StaticResource NavigateLeftButtonStyle}"
                                VerticalAlignment="Center"
                                Width="9"
                                Content="Button"
                                Grid.Column="1" />
                        </Grid>

                        <Grid
                            x:Name="NavigateRight"
                            HorizontalAlignment="Stretch"
                            VerticalAlignment="Stretch"
                            Grid.Column="2"
                            Background="{StaticResource ItemBackground}">

                            <Grid.RowDefinitions>
                                <RowDefinition
                                    Height="*" />
                                <RowDefinition
                                    Height="20" />
                            </Grid.RowDefinitions>

                            <Button
                                x:Name="NavigateRightButton"
                                Height="20"
                                HorizontalAlignment="Center"
                                Margin="0"
                                Grid.Row="1"
                                Style="{StaticResource NavigateRightButtonStype}"
                                VerticalAlignment="Bottom"
                                Width="9"
                                Grid.Column="1"
                                Content="Button" />
                        </Grid>

                        <Canvas
                            x:Name="CanvasPart"
                            Grid.Column="1"
                            MinHeight="30"
                            MinWidth="30"
                            Background="{StaticResource ItemBackground}"
                            VerticalAlignment="Stretch"
                            HorizontalAlignment="Stretch">

                            <Canvas.Clip>
                                <RectangleGeometry
                                    x:Name="ClipRect" />
                            </Canvas.Clip>

                            <Rectangle
                                x:Name="VisibleDatesPart"
                                Canvas.Left="0"
                                Canvas.Top="0"
                                Fill="{StaticResource BandVisibleWindowBackground}">

                            </Rectangle>

                        </Canvas>
                    </Grid>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style
        TargetType="local:TimelineToolbox">
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="local:TimelineToolbox">
                    <Border
                        Background="{StaticResource ItemBackground}"
                        BorderBrush="{StaticResource ItemLineBrush}"
                        Height="20"
                        BorderThickness="0 0 0 1">

                        <Grid
                            x:Name="MainGrid">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition
                                    Width="*" />
                                <ColumnDefinition
                                    Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <StackPanel
                                Orientation="Horizontal"
                                Grid.Column="1">

                                <Button
                                    x:Name="zoomIn"
                                    FontSize="12"
                                    Style="{StaticResource ToolboxButtonStyle}"
                                    FontFamily="Arial DarkGray"
                                    Margin="5 2 2 2"
                                    FontWeight="Bold"
                                    HorizontalAlignment="Right"
                                    Content=" + " />
                                <Button
                                    x:Name="zoomOut"
                                    FontSize="12"
                                    FontFamily="Arial DarkGray"
                                    Style="{StaticResource ToolboxButtonStyle}"
                                    Margin="5 2 2 2"
                                    FontWeight="Bold"
                                    HorizontalAlignment="Right"
                                    Content=" - " />
                                <Button
                                    x:Name="findFirst"
                                    FontSize="15"
                                    Style="{StaticResource ToolboxButtonStyle}"
                                    FontFamily="Webdings"
                                    Margin="15 2 2 2"
                                    HorizontalAlignment="Right"
                                    Content="9" />
                                <Button
                                    x:Name="moveLeft"
                                    FontSize="15"
                                    Style="{StaticResource ToolboxButtonStyle}"
                                    FontFamily="Webdings"
                                    Margin="5 2 2 2"
                                    HorizontalAlignment="Right"
                                    Content="3" />
                                <Button
                                    x:Name="moveRight"
                                    FontSize="15"
                                    Style="{StaticResource ToolboxButtonStyle}"
                                    FontFamily="Webdings"
                                    Margin="5 2 2 2"
                                    HorizontalAlignment="Right"
                                    Content="4" />
                                <Button
                                    x:Name="findLast"
                                    FontSize="15"
                                    Style="{StaticResource ToolboxButtonStyle}"
                                    FontFamily="Webdings"
                                    Margin="5 2 2 2"
                                    HorizontalAlignment="Right"
                                    Content=":" />
                                <Button
                                    x:Name="fullScreen"
                                    FontSize="15"
                                    Style="{StaticResource ToolboxButtonStyle}"
                                    FontFamily="Webdings"
                                    Margin="5 2 2 2"
                                    HorizontalAlignment="Right"
                                    Content="1" />
                            </StackPanel>

                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
